package com.wondertek.poms.dao.po;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

import com.wondertek.poms.common.constant.CurrentUser;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.Proxy;

import com.fasterxml.jackson.annotation.JsonInclude;

import lombok.Data;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * <p><b>MamRecommend Description:</b> 权益标签对应关系表</p>
 * @author douzi
 * <b>DATE</b> 2020年11月18日 下午5:12:35
 */
@Data
@Entity
@Table(name = "MAM_RECOMMEND")
@DynamicUpdate
@DynamicInsert
@Proxy(lazy = false)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class MamRecommend {
	
	@Id
	@Column(name = "ID")
	@GeneratedValue(strategy = GenerationType.AUTO, generator = "MAM_RECOMMEND_SEQ")
	@SequenceGenerator(name = "MAM_RECOMMEND_SEQ", allocationSize = 1, sequenceName = "MAM_RECOMMEND_SEQ")
	private Long id;
	
	@Column(name = "MAM_RECOMMEND")
	private String mamRecommend;
	
	@Column(name = "EQUITY_ID")
	private String equityId;
	
	@Column(name = "CREATE_USER")
	private String createUser;
	
	@Column(name = "CREATE_TIME")
	private String createTime;

	public static void putTimeAndUser(MamRecommend mamRecommend) {
		mamRecommend.setCreateUser(CurrentUser.currUserName());
		Date currentTime = new Date();
		SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		String dateString = formatter.format(currentTime);
		mamRecommend.setCreateTime(dateString);
	}
}
